MainViewItem = BaseListViewItem:Extend()

function MainViewItem:New(...)
    local o = MainViewItem.super.New(self, ...)
    o:Init()
    return o
end

function MainViewItem:Init()
    self.textName = GetNode(self.transform,{"Text"},"Text")
    self.btn_open = self.transform.gameObject
    self:InitEvent()
end

function MainViewItem:InitEvent()
    local click_func = function (target)
        if target == self.btn_open then
			Debug.Log("btn_open {0}", self.data.view)
            UIManager:GetInstance():LoadView(self.data.view)
		end
    end
    AddClick(self.btn_open,click_func)
end

function MainViewItem:SetData(data)
    -- Debug.LogDump(data)
    self.data = data
    if data.name == "" then
        self.textName.text = data.view
    else
        self.textName.text = data.name
    end
end